package com.android.allwinner.newaw360.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/**
 * Created by xiasj on 17-7-5.
 */

public class AW360SharePreferenceUtil {
    private static final String SP_KEY_VIDEO_PATH = "video_path";
    private static final String SP_KEY_VIDEO_DURATION = "video_duration";
    private static final String SP_KEY_CALIBRATE_DATA_PATH = "export_path";
    private static final String DEFAULT_VIDEO_PATH = "/mnt/sdcard/aw360_video/";
    private static final String DEFAULT_VIDEO_DURATION = "180000";


    private static SharedPreferences.Editor sEditor;
    private static SharedPreferences sSP;

    public static void init(Context context) {
        sSP = PreferenceManager
                .getDefaultSharedPreferences(context);
        sEditor = sSP.edit();
    }

    public static void setVideoPath(String path) {
        sEditor.putString(SP_KEY_VIDEO_PATH, path);
    }

    public static String getVideoPath() {
        return sSP.getString(SP_KEY_VIDEO_PATH, DEFAULT_VIDEO_PATH);
    }

    public static void setVideoDuration(int duration) {
        sEditor.putInt(SP_KEY_VIDEO_DURATION, duration);
    }

    public static String  getVideoDuration() {
        return sSP.getString(SP_KEY_VIDEO_DURATION, DEFAULT_VIDEO_DURATION);
    }

    public static void setExportPath(String path) {
        sEditor.putString(SP_KEY_CALIBRATE_DATA_PATH, path);
    }

    public static String getImportPath() {
        return sSP.getString(SP_KEY_CALIBRATE_DATA_PATH, DEFAULT_VIDEO_PATH);
    }
}
